package com.iter.devbox.pattern.composite;

public class Client {

	public static void main(String[] args) {
		Component root = new Composite("根");
		
		Component composite1 = new Composite("树枝1");
		Component composite2 = new Composite("树枝2");

		Component leaf1 = new Leaf("叶子1");
		Component leaf2 = new Leaf("叶子2");
		Component leaf3 = new Leaf("叶子3");
		Component leaf4 = new Leaf("叶子4");
		
		root.add(composite1);
		root.add(composite2);
		
		composite1.add(leaf1);
		composite1.add(leaf2);
		
		composite2.add(leaf3);
		composite2.add(leaf4);
		
		root.display();
	}
}

